package dirty;

/**
 * Created by dllo on 18/4/17.
 */
public class Utils {
    private final Object lock = new Object();
    public  void updatePerson(Person person,String name,int age){
        synchronized (lock){
            person.setName(name);
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            person.setAge(age);
        }
    }
        public void showPerson(Person person){
            System.out.println("姓名"+person.getName());
            System.out.println("年龄"+person.getAge());

    }
    }



